//
//  ForecastMeetingViewController.m
//  Gxj
//
//  Created by 刘伟 on 2017/9/7.
//  Copyright © 2017年 wkq. All rights reserved.
//

#import "ForecastMeetingViewController.h"
#import "ForecastMeetingFromTableViewCell.h"
#import "MyMeetingTableViewCell.h"

@interface ForecastMeetingViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic,strong) UITableView *tableView;

@end

@implementation ForecastMeetingViewController

- (void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.hidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"会议预告";
    
    self.view.backgroundColor = [UIColor whiteColor];
    
    self.navigationController.navigationBar.tintColor = [UIColor whiteColor];
    
    [self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"tbg"]forBarMetrics:UIBarMetricsDefault];
    
    self.navigationController.navigationBar.barStyle=UIBarStyleBlackTranslucent;
    
    self.navigationController.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName:[UIColor whiteColor],NSFontAttributeName:[UIFont boldSystemFontOfSize:17]};
    
    //tableView设置
    [self showForecastMeetingView];
}
//设置对应位置的cell的高度

- (void)showForecastMeetingView
{
    [self.view addSubview:self.tableView];
    
    self.tableView.showsHorizontalScrollIndicator = NO;
    
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;// 去掉所有cell的分割线
    
    self.tableView.tableFooterView = [[UIView alloc] init];
}

#pragma mark - tableViewDelegate
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 10;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return kHeightScale(270);
}

- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return kHeightScale(2);
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [self.navigationController pushViewController:[DetailsOfTheMeetingFromViewController new] animated:YES];
}

#pragma mark - tableViewDataSource
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *reuseID = @"meetingthestorm";
    
    ForecastMeetingFromTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:reuseID];
    
    if (!cell)
    {
        cell = [[ForecastMeetingFromTableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:reuseID];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    [cell.gotoBtn addTarget:self action:@selector(clickGoToBtn:) forControlEvents:UIControlEventTouchUpInside];
    return cell;
}

- (void)clickGoToBtn:(UIButton *)sender
{
    [self.navigationController pushViewController:[DetailsOfTheMeetingFromViewController new] animated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (UITableView *)tableView
{
    if (!_tableView)
    {
        _tableView = [[UITableView alloc] initWithFrame:UIScreenBounds style:UITableViewStyleGrouped];
        
        _tableView.delegate = self;
        
        _tableView.dataSource = self;
    }
    return _tableView;
}

@end
